package Iterator;

import java.util.Iterator;
import java.util.List;

public class PancakeHouseMenuIterator implements Iterator {
    List<Menu> menuItems;
    int position = 0;
    public PancakeHouseMenuIterator(List<Menu>menuItems){
        this.menuItems=menuItems;
    }

    @Override
    public boolean hasNext() {
        if (position>=menuItems.size()||menuItems.get(position)==null){
            return false;
        }
        return true;
    }

    @Override
    public Object next() {
        Menu menuItem=menuItems.get(position);
        position++;
        return menuItem;
        }
    }

